import thrift.protocol.TBinaryProtocol as TBinaryProtocol
import thrift.transport.THttpClient as THttpClient
import evernote.edam.userstore.UserStore as UserStore
import evernote.edam.notestore.NoteStore as NoteStore
import evernote.edam.type.ttypes as Types
from cnconst import CNConst


class CNBooks:
	
	def __init__(self,user,authToken):
		noteStoreUri =  CNConst.noteStoreUriBase + user.shardId
		noteStoreHttpClient = THttpClient.THttpClient(noteStoreUri)
		noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient)
		self.noteStore = NoteStore.Client(noteStoreProtocol)
		self.notebooks = self.noteStore.listNotebooks(authToken)

		
	def syncBooks(self,authToken):
		self.notebooks = self.noteStore.listNotebooks(authToken);

		